Convert duplicate, csv to use new arg scheme. Fix formatting in vecs.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 7 Feb 2003 08:22:18 +0000 (08:22 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 7 Feb 2003 08:22:18 +0000 (08:22 +0000)
gpsbabel/csv.c
gpsbabel/duplicate.c
gpsbabel/vecs.c

index 4302bb0794604c4675a6f8e415cea63ded0220d7..cfc241d3fea5fa350fd2e11555f92efbb2624d65 100644 (file)
@@ -29,6 +29,12 @@ static FILE *file_out;
 static void *mkshort_handle;
 static char *psn;
 
+static
+arglist_t csv_args[] = {
+       {"prefer_shortname", &psn, "Use shortnames even when we have longer names available"},
+       {0, 0, 0}
+};
+
 #define MYNAME "CSV"
 
 static void
@@ -54,8 +60,6 @@ wr_init(const char *fname, const char *args)
 {
        file_out = fopen(fname, "w");
 
-       psn = get_option(args, "prefer_shortname");
-
        if (file_out == NULL) {
                fatal(MYNAME ": Cannot open %s for writing\n", fname);
        }
@@ -194,4 +198,5 @@ ff_vecs_t xmap_vecs = {
        xmap_wr_deinit,
        data_read,
        data_write,
+       csv_args
 };
index a5578404f310db1d46b66e2b249e0e267902d1b8..5b53acc2a96b686135ecbdd50ac689ba450db750 100644 (file)
@@ -25,6 +25,16 @@ extern queue waypt_head;
 
 static int duplicate_shortname = 0;
 static int duplicate_location = 0;
+char *snopt;
+char *lcopt;
+
+static
+arglist_t dup_args[] = {
+       {"shortname", &snopt, "Suppress duplicate waypoints based on name"},
+       {"location", &lcopt, "Suppress duplicate waypoint based on coords"},
+       {0, 0, 0}
+};
+
 
 typedef struct btree_node {
        struct btree_node *left, *right;
@@ -181,22 +191,17 @@ duplicate_process(void)
 }
 
 void
-duplicate_init(const char *args) {
+duplicate_init(const char *args) 
+{
        const char *p;
-       
-       p = get_option(args, "shortname");
-       if (p) {
-               duplicate_shortname = 1;
-       }
 
-       p = get_option(args, "location");
-       if (p) {
-               duplicate_location = 1;
-       }
+       duplicate_shortname = snopt != NULL;
+       duplicate_location = lcopt != NULL;
 }
 
 void
-duplicate_deinit(void) {
+duplicate_deinit(void) 
+{
 }
 
 filter_vecs_t duplicate_vecs = {
index 14a541f77bd27379abe2058438022e5102820030..6e4a3f2d631cae48f1d2fc50a64698407d1ed672 100644 (file)
@@ -315,7 +315,7 @@ disp_vecs(void)
                printf("        %-20.20s  %-50.50s\n",
                        vec->name, vec->desc);
                for (ap = vec->vec->args; ap && ap->argstring; ap++) {
-               printf("          %-10.10s            %-40.40s\n",
+               printf("          %-18.18s    %-50.50s\n",
                        ap->argstring, ap->helpstring);
                }
        }